// pages/applyList/applyList.js

var app = getApp()

const util = require('../../utils/util.js')

Page({

  /**
   * 页面的初始数据
   */
  data: {
		dispatch: {},
		list: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
		this.setData({
			dispatch: app.globalData.trade,
		})

		util.getIndentsByInformation(this.data.dispatch.information.informationId, this)
  },

	signContract: function (e){
		var index = e.currentTarget.dataset.idx
		var indentId = this.data.list[index].indent.indentId
		var phone = this.data.list[index].user.phoneNum
    console.log(index)
		wx.showModal({
			title: '手机号',
			content: phone,
			success: function (res) {
				if (res.confirm) {
					util.changeIdent(indentId, '签约', function () {
						wx.navigateBack({})
					})
				} else if (res.cancel) {
					console.log('用户点击取消')
				}
			}  
		})
	}
})